﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using YTCMS.Domain.Entities;
using YTCMS.Services.Services;

namespace App.Controllers
{
    /// <summary>
    /// 私人订制
    /// </summary>
    public class CustomController : Controller
    {

        private readonly IcustomService _custom;
        public CustomController(IcustomService custom)
        {
            this._custom = custom;
        }
        //
        // GET: /Custom/
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Save(custom custom)
        {
            if (ModelState.IsValid)
            {
                var model = _custom.Add(custom);
                if (model.Id > 0)
                    return new JsonResult() { Data = new { d = true } };
                else
                    return new JsonResult() { Data = new { d = false, msg = "提交失败" } };
            }
            return View();
        }
	}
}